package com.example.object_oriented.inherit;

import org.junit.Test;

/**
 * @author readpage
 * @date 2023-01-05 11:33
 */
public class Dog extends Animal {

    public void eat() {
        System.out.println("dog : eat");
    }

    public void eatTest() {
        this.eat(); // this 调用自己的方法
        super.eat(); // super 调用父类方法
    }

    @Test
    public void test() {
        Animal a = new Animal();
        a.eat();
        Dog d = new Dog();
        d.eatTest();
    }
}
